<template>
  <el-dialog title="撤销报验情况" :visible.sync="show" width="1000px" @closed="closed">
    <el-table v-loading="listLoading" :data="list" size="small" height="calc(100vh - 300px)">
      <el-table-column label="分项工程" prop="checkTypeName" min-width="120" />
      <el-table-column label="工序" prop="checkTableName" min-width="130" />
      <el-table-column label="检验批" prop="batchNumber" align="center" min-width="60" />
      <el-table-column label="检验批说明" prop="description" min-width="150" />
      <el-table-column label="报验人" prop="inspector" min-width="80" />
      <el-table-column label="报验时间" prop="inspectionTime" align="center" min-width="140" />
      <el-table-column label="撤销人" prop="creatorName" min-width="80" />
      <el-table-column label="撤销时间" align="center" min-width="160">
        <el-tag slot-scope="{ row }" type="danger">{{ row.cancelTime }}</el-tag>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </el-dialog>
</template>
<script>
// 撤销报验列表
import { getCancelInspectList } from '@/api/cqCheck'
export default {
  name: 'CancelList',
  data() {
    return {
      show: false,
      listLoading: false,
      list: [],
      total: 0,
      queryParams: { pageNum: 1, pageSize: 10, buildingId: '' }
    }
  },
  methods: {
    closed() {
      this.list = []
      this.total = 0
      this.queryParams = { pageNum: 1, pageSize: 10, buildingId: '' }
    },
    async open(data = {}) {
      this.show = true
      this.queryParams.buildingId = data.buildingId
      this.getList()
    },
    async getList() {
      if (this.listLoading) return
      this.listLoading = true
      const res = await getCancelInspectList(this.queryParams).catch(() => false)
      this.listLoading = false
      if (res === false) return
      this.list = res.rows || []
      this.total = res.total || 0
    }
  }
}
</script>
